//index.js
import tokenManager from '../../mpf/auth/token-manager.js';
Component({
  properties: {
    list:{
      type: Array
    },
    receivingStatus: {
      type: String
    }
  },
  data: {
    img_base_url: global.IMG_BASE_PATH,
  },
  methods: {
    // 整合操作 领取 显示弹层
    operateEvent(e){
      // 判断是否登录
      if (tokenManager.get()){
        let ifprocessing = e.currentTarget.dataset.ifprocessing;
        if (!ifprocessing || this.data.receivingStatus != 1){
          let id = e.currentTarget.dataset.id;
          let index = e.currentTarget.dataset.index;
          let itemInfo = {
            id: id,
            index: index
          };
          this.triggerEvent('sucOperate', itemInfo);
        }
      } else {
        global.login();
      }
    },
    goDetail: function (e) {
      wx.navigateTo({
        url: '/pages/goods/detail?id='+e.currentTarget.dataset.id+'&title='+e.currentTarget.dataset.title,
      })
    }
  }
})

